package com.shop.admin.service.system;


import com.shop.admin.dao.system.SystemUserLevelDao;
import com.shop.domain.system.SystemUserLevel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Slf4j
@Transactional
public class SystemUserLevelService {

    @Autowired
    private SystemUserLevelDao systemUserLevelDao;

    public Map<Long, SystemUserLevel> levelMap() {
        Map<Long, SystemUserLevel> ret = new HashMap<>();
        List<SystemUserLevel> list = systemUserLevelDao.findAll();
        for (SystemUserLevel systemUserLevel : list) {
            ret.put(systemUserLevel.getId(), systemUserLevel);
        }
        return ret;
    }

}
